package com.company;

/**
 * @date : 2022-01-10 下午10:40
 * mysql 建表语句拼接
 *
 * create table test
 * (
 *     id bigint(20) auto_increment primary key ,
 *     name varchar(20) not null
 * );
 * https://www.cnblogs.com/xiaoshahai/p/14048189.html
 * 最多可以建1017列
 */

public class P014_MySQLCreateTable {

    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        ans.append("DROP TABLE IF EXISTS `test`; \n");
        ans.append("create table test (id bigint(20) auto_increment primary key,\n");
        for (int i = 0; i < 1015; i++) {
            ans.append("name_").append(i).append(" varchar(1) DEFAULT '',");
            ans.append("\n");
        }
        ans.append("name").append(" text");
        ans.append(") ENGINE=InnoDB CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;");
        System.out.println(ans.toString());
    }

}
